-module(swfabc_SUITE).
-compile(export_all).

all() -> [u8, u16, s24, u32, u30, d64].

%% simple data types

u8(_) ->
	{123, <<234>>} = swfabc:u8(<<123, 234>>), ok.

u16(_) ->
	{513, <<234>>} = swfabc:u16(<<1,2,234>>), ok.

s24(_) ->
	{-2#100000000000000000000000 + 2#000000000000001000000001, <<4>>} = swfabc:s24(<<1,2,128,4>>), ok.

u32(_) ->
	{127, <<>>} = swfabc:u32(<<2#01111111>>),
	{2#0011111011111110, <<>>} = swfabc:u32(<<2#11111110, 2#01111101>>),
	{2#000111101111111011111110, <<>>} = swfabc:u32(<<2#11111110, 2#11111101, 2#01111011>>),
	{2#00001110111111101111111011111110, <<>>} = swfabc:u32(<<2#11111110, 2#11111101, 2#11111011, 2#01110111>>),
	{2#11111110111111101111111011111110, <<>>} = swfabc:u32(<<2#11111110, 2#11111101, 2#11111011, 2#11110111, 2#00001111>>),
	ok.

u30(_) ->
	{2#00111110111111101111111011111110, <<>>} = swfabc:u30(<<2#11111110, 2#11111101, 2#11111011, 2#11110111, 2#00001111>>),
	ok.

d64(_) ->
	{23.42, <<>>} = swfabc:d64(<<236,81,184,30,133,107,55,64>>), ok.

string(_) ->
	{"lorem ipsum", <<>>} = swfabc:string(<<11, "lorem ipsum">>).

